<script>

$(document).ready(function() {
	$("#okbutton").click(function () {
		var field = $("#field").val();
		var value = $("#value").val();
		$.ajax({
		    type: 'POST',
		    url: context+'user/updateField',
		    dataType: 'json',
		    async: false,
		    data:{'field':field,'value':value},
		    success: function(data){
			   if(data['success'])
			   {
				   $(location).attr('href',context+'user/profil');
			   }
			   else if(data['error'])
			   {
				   $("#error span").text(data['error']);
			   }
			   else if(data['exception'])
			   {
				   $("#error span").text(data['exception']);
			}
		    },
		    error: function(xhr, status, thrown){
		    	 $("#error span").text(xhr.responseText);
		    }
		});
		return false;
	});
});

</script>

<div class="hero-unit">

<div>
Update field

<div id="error">
     <span></span>
  </div>
 <div>
     Field
      <input id="field" type="text" value="firstname" />
  </div>
   <div>
     Value
      <input id=value type="text" value="" />
  </div>
</div>
<button id="okbutton">Ok</button>
</div>

 
 </div>

<div class="row">

</div>
